<?php
/*************************************************

平台投资方案模型 - the
Author: Wanghuabin <18-1-15>

*************************************************/
namespace Home\Model;
use Think\Model\RelationModel;
class RedPacketModel extends RelationModel {
    //获取平台基础信息数据
    public function get_all($map,$field='*',$page=1,$pagenum=9999) {
        $res = $this->where($map)->limit(($page-1)*$pagenum,$pagenum)->field($field)->select();
        return $res;
    }

    //获取单条信息
    public function get_one($map) {
        $res = $this->where($map)->find();
        return $res;
    }

    //添加基础信息
    public function add($data) {
        $res =  M('RedPacket')->data($data)->add();
        return $res;
    }

    //编辑基础信息
    public function edit($map,$postdata) {
        $res = $this->where($map)->save($postdata);
        return $res;
    }

    //删除
    public function del($map) {
        $res = $this->where($map)->delete();
        return $res;
    }

    //计算总数
    public function count($map) {
        $res = M('RedPacket')->where($map)->count();
        return $res;
    }


}